package com.springboot.jktj.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.springboot.common.annotation.Log;
import com.springboot.common.core.controller.BaseController;
import com.springboot.common.core.domain.AjaxResult;
import com.springboot.common.enums.BusinessType;
import com.springboot.jktj.domain.JktjReserve;
import com.springboot.jktj.service.IJktjReserveService;
import com.springboot.common.utils.poi.ExcelUtil;
import com.springboot.common.core.page.TableDataInfo;

/**
 * 套餐预约Controller
 * 
 * @author springboot
 * @date 2023-11-27
 */
@RestController
@RequestMapping("/jktj/reserve")
public class JktjReserveController extends BaseController
{
    @Autowired
    private IJktjReserveService jktjReserveService;

    /**
     * 查询套餐预约列表
     */
    @PreAuthorize("@ss.hasPermi('jktj:reserve:list')")
    @GetMapping("/list")
    public TableDataInfo list(JktjReserve jktjReserve)
    {
        startPage();
        List<JktjReserve> list = jktjReserveService.selectJktjReserveList(jktjReserve);
        return getDataTable(list);
    }

    /**
     * 导出套餐预约列表
     */
    @PreAuthorize("@ss.hasPermi('jktj:reserve:export')")
    @Log(title = "套餐预约", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JktjReserve jktjReserve)
    {
        List<JktjReserve> list = jktjReserveService.selectJktjReserveList(jktjReserve);
        ExcelUtil<JktjReserve> util = new ExcelUtil<JktjReserve>(JktjReserve.class);
        util.exportExcel(response, list, "套餐预约数据");
    }

    /**
     * 获取套餐预约详细信息
     */
    @PreAuthorize("@ss.hasPermi('jktj:reserve:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(jktjReserveService.selectJktjReserveById(id));
    }

    /**
     * 新增套餐预约
     */
    @PreAuthorize("@ss.hasPermi('jktj:reserve:add')")
    @Log(title = "套餐预约", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JktjReserve jktjReserve)
    {
        return toAjax(jktjReserveService.insertJktjReserve(jktjReserve));
    }

    /**
     * 修改套餐预约
     */
    @PreAuthorize("@ss.hasPermi('jktj:reserve:edit')")
    @Log(title = "套餐预约", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JktjReserve jktjReserve)
    {
        return toAjax(jktjReserveService.updateJktjReserve(jktjReserve));
    }

    /**
     * 删除套餐预约
     */
    @PreAuthorize("@ss.hasPermi('jktj:reserve:remove')")
    @Log(title = "套餐预约", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(jktjReserveService.deleteJktjReserveByIds(ids));
    }
}
